/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.factory.web.backing;

import com.factory.web.json.Plan;
import com.factory.web.service.FactoryServiceInterface;
import com.factory.web.service.SchedulerServiceInterface;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 *
 * @author milos
 */

@Component("schedulerBackingBean")
@Scope("request")
public class SchedulerBackingBean {
    
    @Autowired
    SchedulerServiceInterface schedulerService;
    
    @Autowired
    FactoryServiceInterface factoryService;
    
    public List<Plan> getPlans(){
       return schedulerService.getPlans(factoryService.getUserId(), factoryService.getPasswordHash(), factoryService.getInputId());
    }
    
    public String runFactory(Plan plan){
        factoryService.runFactory(plan);
        return "userTasks";
    }
    
    
}
